import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/fund_record_list_entity.dart';

FundRecordListEntity $FundRecordListEntityFromJson(Map<String, dynamic> json) {
  final FundRecordListEntity fundRecordListEntity = FundRecordListEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    fundRecordListEntity.total = total;
  }
  final List<FundRecordListData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<FundRecordListData>(e) as FundRecordListData)
      .toList();
  if (data != null) {
    fundRecordListEntity.data = data;
  }
  return fundRecordListEntity;
}

Map<String, dynamic> $FundRecordListEntityToJson(FundRecordListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension FundRecordListEntityExtension on FundRecordListEntity {
  FundRecordListEntity copyWith({
    int? total,
    List<FundRecordListData>? data,
  }) {
    return FundRecordListEntity()
      ..total = total ?? this.total
      ..data = data ?? this.data;
  }
}

FundRecordListData $FundRecordListDataFromJson(Map<String, dynamic> json) {
  final FundRecordListData fundRecordListData = FundRecordListData();
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    fundRecordListData.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    fundRecordListData.updatedAt = updatedAt;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    fundRecordListData.id = id;
  }
  final String? orgId = jsonConvert.convert<String>(json['orgId']);
  if (orgId != null) {
    fundRecordListData.orgId = orgId;
  }
  final String? uid = jsonConvert.convert<String>(json['uid']);
  if (uid != null) {
    fundRecordListData.uid = uid;
  }
  final String? orderId = jsonConvert.convert<String>(json['orderId']);
  if (orderId != null) {
    fundRecordListData.orderId = orderId;
  }
  final String? deductOrderId = jsonConvert.convert<String>(
      json['deductOrderId']);
  if (deductOrderId != null) {
    fundRecordListData.deductOrderId = deductOrderId;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    fundRecordListData.type = type;
  }
  final String? amount = jsonConvert.convert<String>(json['amount']);
  if (amount != null) {
    fundRecordListData.amount = amount;
  }
  final String? totalBalance = jsonConvert.convert<String>(json['totalBalance']);
  if (totalBalance != null) {
    fundRecordListData.totalBalance = totalBalance;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    fundRecordListData.remark = remark;
  }
  final String? createdAtTime = jsonConvert.convert<String>(
      json['createdAtTime']);
  if (createdAtTime != null) {
    fundRecordListData.createdAtTime = createdAtTime;
  }
  return fundRecordListData;
}

Map<String, dynamic> $FundRecordListDataToJson(FundRecordListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['id'] = entity.id;
  data['orgId'] = entity.orgId;
  data['uid'] = entity.uid;
  data['orderId'] = entity.orderId;
  data['deductOrderId'] = entity.deductOrderId;
  data['type'] = entity.type;
  data['amount'] = entity.amount;
  data['totalBalance'] = entity.totalBalance;
  data['remark'] = entity.remark;
  data['createdAtTime'] = entity.createdAtTime;
  return data;
}

extension FundRecordListDataExtension on FundRecordListData {
  FundRecordListData copyWith({
    int? createdAt,
    int? updatedAt,
    int? id,
    String? orgId,
    String? uid,
    String? orderId,
    String? deductOrderId,
    int? type,
    String? amount,
    String? totalBalance,
    String? remark,
    String? createdAtTime,
  }) {
    return FundRecordListData()
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..id = id ?? this.id
      ..orgId = orgId ?? this.orgId
      ..uid = uid ?? this.uid
      ..orderId = orderId ?? this.orderId
      ..deductOrderId = deductOrderId ?? this.deductOrderId
      ..type = type ?? this.type
      ..amount = amount ?? this.amount
      ..totalBalance = totalBalance ?? this.totalBalance
      ..remark = remark ?? this.remark
      ..createdAtTime = createdAtTime ?? this.createdAtTime;
  }
}